package chapter02;

/**
 * 循环体的过滤器
 * 使用continue关键字放弃部分循环体
 * break和continue语句都是对循环体对控制语句，它们不仅应用于for循环，在任何循坏体中都可以使用这些语句
 * Created by a on 2017/6/9.
 */
public class Test40 {
    public static void main(String[] args) {
        //创建数组
        String[] array = {"白鹭","丹顶鹤","黄鹂","鹦鹉","乌鸦","喜鹊","老鹰","布谷鸟","老鹰","灰文鸟","老鹰","百灵鸟"};
        System.out.println("在我的花园里有很多鸟类,但最近来了几只老鹰,请帮我抓住它！");
        int eagleCount = 0;
        for (String str : array){
            if (str.equals("老鹰")){
                eagleCount++;
                System.out.println("发现一只老鹰,现在已经抓到笼子里了,共抓住了"+eagleCount+"只老鹰");
                continue;
            }
            System.out.println("发现鸟类："+str+"  ");
        }
    }
}
